import {createStore} from "redux"

let data:any={
    list:[]
}

function reducer(state:any=data,action:any){
    state=JSON.parse(JSON.stringify(state))
    switch(action.type){
        case "LIST":
            state.list=action.list
            return state
        case "SETSIZE":
            // console.log(action.id,action.index)
          let a=state.list.filter((item:any)=>item.id==action.id)[0]
            a.select[action.index].size++
            a.size++
            return state

        default :
            return state
    }

}

let store=createStore(reducer)
export default store